package com.bana.fvs.app.mvp.model;

import com.bana.fvs.app.app.MyApp;
import com.bana.fvs.app.main.entity.UserInfoBean;
import com.bana.fvs.app.mvp.ConstantsValue;
import com.bana.fvs.app.mvp.contract.ChangePwdContract;
import com.bana.fvs.app.util.UserInfoUtils;
import com.wei.commonlibrary.net.OkhttpRequest;
import com.wei.commonlibrary.utils.GlobalContext;

import java.util.HashMap;


/**
 * Author : yanftch
 * Date : 2018/3/1
 * Time : 21:20
 * Desc :
 */

public class ChangePwdModel extends ChangePwdContract.AbsChangeModel {
    @Override
    public void onStart() {

    }

    @Override
    public OkhttpRequest http_updatePwd(String token, String originalPwd, String newPwd) {

        UserInfoBean userInfo = UserInfoUtils.getInstance().getUserInfo(GlobalContext.context);
        HashMap<String, Object> map = new HashMap<>();
        HashMap<String, Object> data = new HashMap<>();
        if(userInfo!=null)
        data.put("yhmc",userInfo.getYhmc());
        data.put(ConstantsValue.ORIGINALPWD, originalPwd);//旧密码
        data.put(ConstantsValue.PASSWORD, newPwd);//新密码
        map.put("data",data);
        return okhttpRequest.url(iApiService.updateUserPwd(map));
    }
}
